<layout name='Layout/layout_page' />
	
	<ol class="breadcrumb">
		<li><a href="<{:U('Goods/index')}>">商品管理</a></li>
      	<li class="active">商品分类</li>
    </ol>

    <div class="row">
    	<div class="col-sm-12"><a class="btn btn-info btn-sm" href="<{:U('ShopCate/add')}>">添加分类</a></div>
    </div>	

	<p></p>

	<TABLE class="table table-striped table-bordered table-hover">
	  <THEAD>
		<tr>
		  <th>ID</th>
		  <TH>名称</TH>
		  <TH>排序</TH>
		  <TH>操作</TH>
		</tr>
	  </THEAD>
	  <TBODY>             
			<volist name="list" id="vo">
			<tr>
			  <td><{$vo.id}></td>
			  <td <{$vo.style}>><eq name="vo.fid" value="0"><strong></eq><{$vo.name}><eq name="vo.fid" value="0"></strong></eq></td>
              <td><{$vo.sort}></td>
			  <td>
			  	<a href="<{:U('ShopCate/edit' , array('id'=>$vo['id']))}>" class="btn btn-default btn-sm"><i class="glyphicon glyphicon-edit"></i> 编辑</a>
			  	<a href="javascript:void(0);" attr="delaccount_<{$vo['id']}>" class="btn btn-default btn-sm"><i class="glyphicon glyphicon-trash"></i> 删除</a>
			  	<a href="<{:U('ShopCate/add',array('fid'=>$vo['id'],'path'=>$vo['path']))}>" class="btn btn-info btn-sm"><i class='glyphicon glyphicon-plus icon-white'></i> 添加子栏目</a>
			  </td>
			</tr>
			</volist>
	  </TBODY>
	</TABLE>

<script type="text/javascript">
$(document).ready(function() {
	$("a[attr^='delaccount_']").each(function(){
		var tmp = $(this).attr('attr').split('_');
		$(this).bind("click",function(){			
			var dialog = art.dialog({				
				content:'删除后不可恢复，确认吗？',
				ok:function(){
					this.content('正在删除');
					$.ajax({
						url: "<{:U('ShopCate/del')}>&id="+tmp[1]+"&temp="+new Date().getTime(),
						success: function (data){
							if(data==1){
								window.location.href = "<{:U('ShopCate/index')}>";
							}else if(data==2){
								dialog.content('请先删除子栏目').time(2);
							}else{
								dialog.content('删除失败').time(2);
							}
						},
					});
                	return false;
					},	
				lock : true,
			});	
		});
	});
});
</script>



<input type="hidden" id="menu_action" value="goods" />
